<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'shenhe.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  <body>
    This is my JSP page. <br>
    审核中请耐心等待几分钟...
<input id="a" type="button" style="background:url(./images/but_C_logon.gif);width:150px;height:30px;"  id="sheng"  onClick="show();"/>
<div id="d" onmousedown="Milan_StartMove(event,'d')" onmouseup="Milan_StopMove(event)" style="cursor:move;display:none;position:absolute;top:150px;left:100px;width:400px;height:300px;z-index:3;">
<span id = "sp" onClick="hidden();" style="width:40px;height:20px;float:right;font-size:12px;cursor:hand;" cou>[&nbsp;关闭&nbsp;]</span>
<%
	Class.forName("com.mysql.jdbc.Driver");
	Connection con = DriverManager.getConnection("jdbc:mysql://localhost/jobs?useUnicode=true&characterEncoding=utf8","root","123456");
	Statement st = con.createStatement();
		ResultSet rs = st.executeQuery("select * from area where id like '__'");
		while(rs.next()){
		%>
	<input id="cb<%=rs.getInt("id") %>"type="button" value="<%=rs.getString("name") %>" onClick="area('sheng','<%=rs.getInt("id")%>');"/>
		<%}%>


</div>
<div id="dd" onmousedown="Milan_StartMove(event,'dd')" onmouseup="Milan_StopMove(event)" style="cursor:move;display:none;position:absolute;top:350px;left:100px;width:400px;height:300px;z-index:5;background-color:red;">
<select id="xian" ><option selected="selected">请选择</option></select>
  </body>
</html>
<script src="./includes/ajax.js"></script>
<script>
function show(){
	var a = document.getElementById("d");
	a.style.display="block";
}
function hidden(){
	var a = document.getElementById("d");
	a.style.display="none";
}
function area(area,id){
var a = document.getElementById("a");
var  d = document.getElementById("cb"+id);
	a.value = d.value;
	var ajax=initAjax();
	ajax.open("get","<%=basePath%>servlet/AreaServlet?id="+id+"&r="+Math.random(),true);
	ajax.send(null);
	ajax.onreadystatechange = function(){
		if(ajax.readyState == 4){
		var d = document.getElementById("dd");
			 d.innerHTML = ajax.responseText;
			 d.style.display="block";
		}
	}
}
      var offset_x;
        var offset_y;
        function Milan_StartMove(oEvent,id)
        {
            var whichButton;
            if(document.all&&oEvent.button==1) whichButton=true;
            else { if(oEvent.button==0)whichButton=true;}
            if(whichButton)
            { 
                var oDiv=document.getElementById(id);
                offset_x=parseInt(oEvent.clientX-oDiv.offsetLeft);
                offset_y=parseInt(oEvent.clientY-oDiv.offsetTop);
                document.documentElement.onmousemove=function(mEvent)
                {    
                    var eEvent;
                    if(document.all) eEvent=event;
                    else{eEvent=mEvent;}
                    var oDiv=document.getElementById(id);
                    var x=eEvent.clientX-offset_x;
                    var y=eEvent.clientY-offset_y;
                    oDiv.style.left=(x)+"px";
                    oDiv.style.top=(y)+"px";
                }
            }
        }
        function Milan_StopMove(oEvent,id){document.documentElement.onmousemove=null; }
</script>